<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ page import="com.gouwudai.gobbs.pojo.TbbsClass,com.gouwudai.gobbs.pojo.TbbsTopic,com.gouwudai.gobbs.pojo.TbbsTopicRe" %>
<%@ include file="../../common/common.jsp" %>
<%
int pageIndex = ParamUtils.getIntParameter(request, "pageIndex", 1);
int topicId =  ParamUtils.getIntParameter(request,"topicId");
int classId = ParamUtils.getIntParameter(request, "classId", 0);

ITopicReService topicReService = (ITopicReService)BeanManager.getBean("topicReService");
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>显示回复</title>
<script language="JavaScript" type="text/JavaScript">
<!--
var ie4 = document.all && navigator.userAgent.indexOf("Opera") == -1;
var ns6 = document.getElementById && !document.all;
var ns4 = document.layers;
var opera = navigator.userAgent.indexOf("Opera")!=-1;
function loadtree(id) {
  var sobj = ie4 ? eval("document.all.threadtree_" + id): ns6 
  				? document.getElementById("threadtree_" + id ) : ns4 
				? eval("document.threadtree_" + id) : opera
				? document.getElementById("threadtree_" + id ) : "";
				
  var tobj = ie4 ? eval("parent.document.all.replies_" + id) : ns6 
  				? parent.document.getElementById("replies_" + id ) : ns4 
				? eval("parent.document.replies_" + id) : opera
				? parent.document.getElementById("replies_" + id ) : "";
		
	
	if(sobj != null && tobj != null) {
		if(ns6 || ie4 || opera) {
      		tobj.innerHTML = sobj.innerHTML;
    	}
    	else {
      		tobj.document.write(sobj.innerHTML);
      		tobj.document.close();
    	}
  }else{
  	
  }
}
//-->
</script>
</head>
<body onLoad="loadtree(<%=topicId%>)">
<div id="threadtree_<%=topicId%>">
<!--=============回复内容开始==================-->
	<%
	List topicReList = topicReService.listByTopic(topicId,pageIndex,8);
	int totalRowCount = topicReService.listCountByTopic(topicId);
	TbbsTopicRe tbbsTopicRe = null;
	for(int j=0;j<topicReList.size();j++)
	{
		tbbsTopicRe = (TbbsTopicRe)topicReList.get(j);
	%>
		<DIV class="line"></DIV>
		<DIV class="list_tab_2">
		<%=Arguments.getTopicReTreeDisplay(j,totalRowCount) %>
		<%=Arguments.getTopicMoodDisplay(tbbsTopicRe.getReMood()) %>〖<%=Arguments.getUserInfoLink(tbbsTopicRe.getUserId(),tbbsTopicRe.getLoginId()) %>〗<%=Arguments.getTopicReLink(tbbsTopicRe,pageIndex) %>		
		&nbsp;<%=HtmlConst.formatDateHtml(tbbsTopicRe.getReAddTime()) %>
		&nbsp;<i class="smallTxt"><%=Arguments.getTopicLenDisplay(classId,tbbsTopicRe.getTopicId().intValue(),tbbsTopicRe.getTopicReId().intValue(),tbbsTopicRe.getReLen().intValue(),true) %></i>
		</DIV>
	<%} %>
<DIV  class="list_tab_2" style="height:24;">
&nbsp;&nbsp;共 <strong><%=totalRowCount%></strong> 条回帖
<%
int totalPage = totalRowCount / 8;
if ((totalRowCount % 8) != 0)
    totalPage++; 
for(pageIndex=1; pageIndex<=totalPage; pageIndex++){%>
&nbsp;<a onclick="loadTreeNoimg(<%=topicId%>,'includes/topic_re_tree.jsp?classId=<%=classId%>&topicId=<%=topicId%>&pageIndex=<%=pageIndex%>')" style="cursor:hand;">
&lt;<%=pageIndex%>&gt;</a>
<%}%>
</DIV>
<%if(totalRowCount==0){%>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="topic_post.jsp?classId=<%=classId%>&topicId=<%=topicId%>">本主暂无回复</a>
<%}%>
</div>
</body>
</html>